﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils.Extention;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/9/22 18:07:16
* 文件名：DLeg.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Web.category
{
    public partial class DLeg : System.Web.UI.Page
    {
        protected string title, description, keyWrods, bgImage, adScroll;

        protected int catid;
        protected string href, desc;
        protected void Page_Load(object sender, EventArgs e)
        {
            catid = 8;
            if (!this.IsPostBack)
            {
                ChinaLeg.Cache.Category.Instance.GetModel(catid, out title, out  keyWrods, out  description, out  bgImage);
                Top1.CatId = catid;
                Top1.BgImage = bgImage;
                adScroll = ChinaLeg.Cache.ScrollFocusPicture.Instance.GetList(catid);

                List<ChinaLeg.Model.News> list = ChinaLeg.BLL.News.Instance.GetList(" and ListCommend=1 and catid=60", 10, "ShowOrder", 0);
                rpt60.DataSource = list;
                rpt60.DataBind();

                if (list.Count > 0)
                {
                    href = ChinaLeg.Web.Lib.WebLinks.GetNewsLinks(list[0].Id);
                    desc = list[0].Description.SubStringByBytes(150, false);

                }
                //BindNews(rpt60, 60);
                BindNews(rpt40, 40);
                BindNews(rpt41, 41);
                int recordCount;
                rptCase42.DataSource = ChinaLeg.BLL.CasePictrue.Instance.GetList(" and catid=42 ", 5, 1, out recordCount);
                rptCase42.DataBind();

            }

        }

        private void BindNews(Repeater rpt, int catid)
        {
            rpt.DataSource = ChinaLeg.BLL.News.Instance.GetList(" and ListCommend=1 and catid=" + catid, 10, "ShowOrder", 0);
            rpt.DataBind();
        }
    }
}